/* -*- C++ -*-   vim: set syntax=cpp:
 * (C) Frank-Rene Schaefer                               */
#ifndef __QUEX_INCLUDE_GUARD__ANALYZER__COUNTER
#define __QUEX_INCLUDE_GUARD__ANALYZER__COUNTER

#if ! defined(__QUEX_OPTION_PLAIN_C)
#   include <cstddef> 
#else
#   include <stddef.h>
#endif
#include <quex/code_base/definitions>

QUEX_NAMESPACE_MAIN_OPEN

#   if defined(QUEX_OPTION_INDENTATION_TRIGGER)
    typedef struct {
        QUEX_TYPE_INDENTATION   front[QUEX_SETTING_INDENTATION_STACK_SIZE];
        QUEX_TYPE_INDENTATION*  back;         /* pointer to last element */
        QUEX_TYPE_INDENTATION*  memory_end;
    } QUEX_NAME(IndentationStack);

	QUEX_INLINE void
	QUEX_NAME(IndentationStack_init)(QUEX_NAME(IndentationStack)* me);
#   endif

    typedef struct {
#       ifdef  QUEX_OPTION_LINE_NUMBER_COUNTING
        size_t  _line_number_at_begin;    /* line where current pattern starts   */
        size_t  _line_number_at_end;      /* line after current pattern          */
#       endif
#       ifdef  QUEX_OPTION_COLUMN_NUMBER_COUNTING
        size_t  _column_number_at_begin;  /* column where current pattern starts */
        size_t  _column_number_at_end;    /* column after current pattern        */
#       endif
#       ifdef   QUEX_OPTION_INDENTATION_TRIGGER
        QUEX_NAME(IndentationStack) _indentation_stack;
        QUEX_TYPE_INDENTATION       _indentation;
#       endif
    } QUEX_NAME(Counter);


    QUEX_INLINE void  QUEX_NAME(Counter_construct)(QUEX_NAME(Counter)*  me); 
    QUEX_INLINE void  QUEX_NAME(Counter_init)(QUEX_NAME(Counter)* me);
    QUEX_INLINE void  QUEX_NAME(Counter_reset)(QUEX_NAME(Counter)* me);
    QUEX_INLINE void  QUEX_NAME(Counter_copy_construct)(QUEX_NAME(Counter)*  me, 
                                                       const QUEX_NAME(Counter)*       That);

    QUEX_INLINE void  QUEX_NAME(Counter_count)(QUEX_NAME(Counter)*             me, 
                                                         QUEX_TYPE_CHARACTER*  Lexeme, 
                                                         QUEX_TYPE_CHARACTER*  LexemeEnd);
    QUEX_INLINE QUEX_TYPE_CHARACTER*
    QUEX_NAME(Counter_count_chars_to_newline_backwards)(QUEX_NAME(Counter)*   me, 
                                                        QUEX_TYPE_CHARACTER*  Begin,
                                                        QUEX_TYPE_CHARACTER*  End);

    QUEX_INLINE void  QUEX_NAME(Counter_print_this)(QUEX_NAME(Counter)* me);

QUEX_NAMESPACE_MAIN_CLOSE

#endif /* __QUEX_INCLUDE_GUARD__ANALYZER__COUNTER */

